package com.faradel.pharmapp.dao;

import java.util.List;
import java.util.Map;

import org.faradel.pharmapp.entities.MedicationInventory;
import org.hibernate.Query;
import org.springframework.stereotype.Repository;

@Repository("medicationInventoryDaoImpl")
public class MedicationInventoryDaoImpl extends GenericDAOImpl<MedicationInventory, Integer> implements MedicationInventoryDAO
{

    @Override
    public List<MedicationInventory> findByColumn(Map<String, String> map)
    {
        return null;
    }

    @SuppressWarnings("unchecked")
    @Override
    public List<MedicationInventory> getLowInventory()
    {
        Query query = this.sessionFactory.getCurrentSession().createSQLQuery("Select * from MedicationInventory Where available_quantity <= reorder_quantity and order_status = 'N'").addEntity(MedicationInventory.class);
        return query.list();
    }

}
